<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include :: header('书籍分类')"></head>
<body>
<section class="content">
    <form id="form" class="form-horizontal" th:object="${bookCategory}">
        <input type="hidden" name="id" th:value="*{id}">
        <div class="box-body">
            <div class="form-group">
                <label for="name" class="col-sm-2 control-label">分类名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="name" name="name" placeholder="分类名称" th:value="*{name}"
                           autocomplete="off">
                </div>
            </div>
            <div class="form-group">
                <label for="status" class="col-sm-2 control-label">状态</label>
                <div class="col-sm-10">
                    <select id="status" name="status" class="form-control select2" th:field="*{status}">
                        <option value="0">展示</option>
                        <option value="1">收起</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="remarks" class="col-sm-2 control-label">备注</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="remarks" name="remarks" placeholder="备注"
                           autocomplete="off" th:value="*{remarks}">
                </div>
            </div>
        </div>
        <div class="box-footer" style="display: none">
            <button id="btn" type="button" class="btn btn-info pull-right" onclick="save()"></button>
        </div>
    </form>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    /**
     * 保存数据
     */
    function save() {
        var formData = new FormData($("#form")[0]);
        form('/sys/in/bookCategory/save', formData, function (res) {
            window.parent.loaded(res.msg,res.code)
        }, function (error) {
            window.parent.loaded(error)
        })
    }
</script>
</body>